package com.alisls.demo.springcloud.service.user.client.oauth;

import com.alisls.demo.springcloud.service.user.dto.login.TokenQuery;
import com.alisls.demo.springcloud.service.user.interceptor.TokenFeignClientInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 描述信息
 *
 * @author Ke Wang
 * @date 2020/10/31
 */
@FeignClient(name = "demo-springcloud-2-oauth-server", contextId = "tokenFeignClient",
        configuration = TokenFeignClientInterceptor.class)
public interface TokenFeignClient {

    /**
     * 密码模式获取Token
     * @param authorization
     * @param grantType
     * @param username
     * @param password
     * @return
     */
    @PostMapping("/oauth/token")
    String token(@RequestHeader("Authorization") String authorization,
                 @RequestParam("grant_type") String grantType,
                 @RequestParam("username") String username,
                 @RequestParam("password") String password);

    /**
     * 客户端模式获取Token
     * @param authorization
     * @param grantType
     * @return
     */
    @PostMapping("/oauth/token")
    String token(@RequestHeader("Authorization") String authorization,
                 @RequestParam("grant_type") String grantType);

}
